<?php

class Activity_Controller_Browse_Ajax_Comment_Add extends Nuo_Controller
{
	function execute($request)
	{
		$table = Nuo::getTable('base/comment');

		list($type, $id) = explode('_', $request -> getParam('data-id'));

		$object = Nuo::getItem($type, $id);

		$viewer = Nuo::getUser();

		$result = Nuo::getApi('membership') -> addComment($viewer, $object);

		if ($result == 1)
		{
			/**
			 * @todo process like to make sure no re-like again.
			 */
			// Nuo::getApi('activity') -> addFeed($viewer, $object, 'like.like');
			echo 'liked';
		}
		else
		{
			echo 'unliked';
		}
	}

}
